<extend name="Common/common" />
<block name="main">
  <div id="page-wrapper" class="gray-bg dashbard-1">
    <include file="Common/nav-header"/> <!--顶部-->
    <div class="wrapper wrapper-content">
      <div class="col-lg-12">
        <div class="ibox float-e-margins">
          <div class="ibox-title">
            <h5>{$get_id?'编辑书单':'添加书单'}</h5>
          </div>
          <div class="ibox-content">
            <form class="form-horizontal m-t " method="post" action="{:U('add')}">
              <h3>请输入书单名称</h3>
              <div class="input-group input-group-lg">
               <if condition="$get_id neq null">
                <volist name="data" id="vo1"> 
                  <input type="hidden" name="id" value="{$vo1.id}">
                  <span class="input-group-addon" id="sizing-addon1">@</span>
                  <input type="text" name="name" class="form-control" placeholder="请输入书单名称..." aria-describedby="sizing-addon1" value="{$vo1.name}">
                </volist>
                <else/>
                <span class="input-group-addon" id="sizing-addon1">@</span>
                <input type="text" name="name" class="form-control" placeholder="请输入书单名称..." aria-describedby="sizing-addon1">
              </if>
            </div>
            <h3>请输入书单地址</h3>
            <div class="input-group input-group-lg">
             <if condition="$get_id neq null">
              <volist name="data" id="vo1"> 
                <input type="hidden" name="id" value="{$vo1.id}">
                <span class="input-group-addon" id="sizing-addon1">@</span>
                <input type="text" name="url" class="form-control" placeholder="请输入书单地址..." aria-describedby="sizing-addon1" value="{$vo1.url}">
              </volist>
              <else/>
              <span class="input-group-addon" id="sizing-addon1">@</span>
              <input type="text" name="url" class="form-control" placeholder="请输入书单地址..." aria-describedby="sizing-addon1">
            </if>
          </div>   
          <div class="form-group">
            <div class="col-sm-4" style="margin-top: 10px;">
              <button class="btn btn-primary" type="submit">提交</button>
            </div>
          </div>
        </if>
      </form>
    </div>
  </div>
</div>
</div>
<!--尾部-->
<include file="Common/admin:footer"/>
</div>

<script>
  $('form').submit(function(){
    var title = $('#title').val();
    var editor = $("#editor").val();
    if(title == ''){
      layer.msg('请填写文章标题',{time:1000});
      return false;
    }
    if(editor == ''){
      layer.msg('请填写文章内容',{time:1000});
      return false;
    }
  });
</script>
</block>

